package com.chengyanan.conf;

import org.apache.kafka.clients.consumer.ConsumerConfig;

import java.util.Properties;

/**
 * @ Author: Chengyanan
 * @ Date: 2019/8/21 11:21
 * @ Description :
 */
public class KafkaProperties {

    private static String topic = ConfigurationManager.getProperty("topic");

    public static Properties getKafkaProperties(){
        Properties prop = new Properties();
        prop.put(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, ConfigurationManager.getProperty("bootstrap.servers"));
        prop.put(ConsumerConfig.GROUP_ID_CONFIG, ConfigurationManager.getProperty("group.id"));
        prop.put(ConsumerConfig.ENABLE_AUTO_COMMIT_CONFIG, ConfigurationManager.getProperty("enable.auto.commit"));
        prop.put(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG,"org.apache.kafka.common.serialization.StringDeserializer");
        prop.put(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG,"org.apache.kafka.common.serialization.StringDeserializer");
        prop.put(ConsumerConfig.AUTO_OFFSET_RESET_CONFIG,"earliest");
        prop.put(ConsumerConfig.MAX_POLL_RECORDS_CONFIG,"1000");
        return prop;
    }

    public static String getTopic(){
        return topic;
    }
}
